<html>
  <head>
    <link type="text/css" rel="stylesheet" href="/stylesheets/sma.css" />
  </head>
  <body>

    {% if action == 'list' %}

      {% include "error.html" %}

      <center>
      <h1>ORUUC</h1>
      <h2>Shared Ministry Agreements</h2>
      {% if admin %}
      <p class="fineprint">Version: {{version}}
      {% endif %}
      <h3>Groups</h3>
      <p>Logged in as {{user.nickname()}}</p>
      {% if writeable %}
      <a href="/group/new">Start a Shared Ministry Agreement for a new
      group</a>
      {% else %}
      <p class="fineprint">Shared Ministry Agreement creation and
      editing is currently disabled. Please contact Nancy Starr for
      information.</p>
      {% endif %}

      <p class="fineprint">For funding requests to be considered in
        the budget for the coming fiscal year (July 1 - June 30), 
        <br>please file your group's Shared Ministry Agreement by April 15.
      <p>

      <table width="80%" class="simple"><tr>
          <th class="simple" width="5%">View
          <th class="simple" width="5%">Edit
          <th class="simple" width="5%">Hide
          {% if admin %}
          <th class="simple" width="5%">Delete
          {% endif %}
          <th class="simple">Group Name
          <th class="simple">Reviewed
          <th class="simple">Last Updated
          <th class="simple">By
        {% for group in groups %}
            {% if admin or not group.sma_hidden %}
              </tr><tr>
                <td class="simple">
                  <a href="/group/view?group_id={{group.key().id()}}">View</a>
                <td class="simple">

                  {% if writeable %}
                  <a href="/group/update?group_id={{group.key().id()}}">Edit</a>
                  {% else %}
                  <font color="gray">Edit</font>
                  {% endif %}

                <td class="simple">

                {% if group.sma_hidden and admin %}
                  {% if writeable %}
                  <a href="/group/unhide?group_id={{group.key().id()}}">Unhide</a>
                  {% else %}
                  <font color="gray">Unhide</font>
                  {% endif %}
                {% else %}
                  {% if writeable %}
                  <a href="/group/hide?group_id={{group.key().id()}}">Hide</a>
                  {% else %}
                  <font color="gray">Hide</font>
                  {% endif %}
                {% endif %}

                {% if admin %}
                <td class="simple">
                  {% if writeable %}
                  <a href="/group/delete?group_id={{group.key().id()}}">Delete</a>
                  {% else %}
                  <font color="gray">Delete</font>
                  {% endif %}
                {% endif %}

                <td class="simple">{{group.sma_name}}
                <td class="simple" align="center">{{group.sma_annual_review}}
                <td class="simple">{{group.sma_updated.strftime(dt_format)}}
                <td class="simple">{{group.sma_updater.nickname()}}
            {% endif %}
        {% endfor %}
      </tr></table>

      <p><a href="{{logout}}">Logout</a>
      {% if admin %}
      <p><a href="/person">person list</a>
      {% endif %}
      </center>

    {% elif action == 'new' or action == 'update' %}

      {% include "error.html" %}

      <center>
      <h1>ORUUC</h1>
      <h2>Shared Ministry Agreements</h2>
      {% if action == 'new' %}
      <h3>Creating a New Group</h3>
      {% else %}
      <h3>Editing '{{cache.sma_name}}'</h3>
      {% endif %}
      </center>

       <!---------------------------------------------->
       <form action="/group/save" method="post">
         {% include "post_table.html" %}
         <input type="hidden" name="action" value="{{action}}">

         <!---------------------------------------------->
         <h4>Section 1: Group Information</h4>
         <input type="hidden" name="group_id" value="{{group_id}}">

         <!---------------------------------------------->
         <p>Name of Group/Ministry:
         <br><input class="wide_input" type="text" name="sma_name"
                    size=80 value="{{cache.sma_name}}"/>

         <!---------------------------------------------->
         <p>Purpose/Description of Group/Ministry:
           <br>
           <textarea name="sma_purpose_t"
                     class="wide_input" 
                     cols="80" 
                     rows="5">{{cache.sma_purpose_t}}</textarea>

         <!---------------------------------------------->
         <p>Co-leaders (Please provide first and last names for up to
         three group leaders, one per line):
           <textarea name="sma_leaders"
                     class="wide_input"
                     rows="3">{{cache.sma_leaders}}</textarea>

         <!-- -------------------------------------------->
         <p>Members (please list all group members other than
         co-leaders, one person per line):
           <textarea name="sma_members"
                     class="wide_input"
                     rows="10">{{cache.sma_members}}</textarea>

         <!---------------------------------------------->
         <hr>
         <h4>Section 2: How does this group connect with the rest of
         ORUUC? (If this section is confusing, it may be easier to
         complete it in conversation with staff -- that's OK!</h4>

         <p>Staff Liason (if known):
         <br><select name="sma_staff">
           {% for staff in staff_l %}
             {% if staff_name == staff %}
             <option value="{{staff.replace(' ', '_')}}"
                     selected="selected">{{staff}}</option>
             {% else %}
             <option value="{{staff.replace(' ', '_')}}">{{staff}}</option>
             {% endif %}
           {% endfor %}
           </select>

         <!---------------------------------------------->
         <p>Coordinating Council Liason (if known):
           <br><textarea name="sma_council"
                     class="wide_input"
                     rows="2">{{cache.sma_council}}</textarea>

         <!---------------------------------------------->
         <p>ORUUC's Vision is harmonious, respectful and loving relationships with
            all of creation.
         <br>ORUUC's Mission: We are a diverse, religious community joyfully
             nurturing one another in our lifelong spiritual journeys, and
             committing to tranform ourselves and the world around us through
             acts of compassion, love and social justice.

         <p>How does this group/ministry support ORUUC’s Vision and
         Mission?

         <br>
         <textarea name="sma_support_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_support_t}}</textarea>

         <!---------------------------------------------->
         <p>Which of the Strategic Plan's goals or objectives does this
            group/ministry PRIMARILY pursue?

           {% for goal in range(1,8) %}
               <br><input type="radio" name="sma_goal"
                          value="goal_{{goal}}"
                    {% if cache.sma_goal == "goal_%d" % goal %}
                          checked
                    {% endif %}
                          />
             {{ goal_list[goal-1] }}
           {% endfor %}

         <!---------------------------------------------->
         <p>How does this ministry pursue that goal/objective?
         <br>
         <textarea name="sma_goalhow_t"
                   class="wide_input"
                   rows="5">{{cache.sma_goalhow_t}}</textarea>

         <!---------------------------------------------->
         <p>What other Strategic Plan goals or objectives does this
         group/ministry pursue?

           {% for gnum in range(1,8) %}
              <br><input type="checkbox" 
                         name="sma_altgoals"
                         value="goal_{{gnum}}"
              {% if 'goal_%d' % gnum in cache.sma_altgoals %}
                         checked="1"
              {% endif %}
              />
              {{ goal_list[gnum-1] }}
           {% endfor %}

         <!---------------------------------------------->
         <p>With what other ORUUC groups (if any) does your group
         interact?
         <br>
         <textarea name="sma_other_groups_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_other_groups_t}}</textarea>

         <!---------------------------------------------->
         <p>How does this group share what it is doing with the wider
         congregation? (Check all that apply.)

           {% for item in comm_list %}
              <br><input type="checkbox" 
                         name="sma_comm"
                         value="{{item}}"
              {% if item in cache.sma_comm %}
                         checked="1"
              {% endif %}
              {% if 'specify' in item %}
                         onclick="toggle(sma_comm_other);"
              {% endif %}
              />
              {{ item }}
              {% if 'specify' in item %}
              <br>
              <textarea name="sma_comm_other"
                        class="wide_input"
                        rows="5">{{cache.sma_comm_other}}</textarea>
              {% endif %}
           {% endfor %}

         <!---------------------------------------------->
         <p>Are there safety/liability concerns? If so please list:
         <br>
         <textarea name="sma_safety_t" 
                   class="wide_input" 
                   rows="5">{{cache.sma_safety_t}}</textarea>

         <!---------------------------------------------->
         <p>Section 3: GROUP PROCESS

         <p>Time Period
           {% for cyc in cycle_d.keys() %}
              <br><input type="radio" name="sma_cycle"
                         value="{{cyc}}"
                         id="sma_cycle_{{cyc}}"
                      {% if cache.sma_cycle == cyc %}
                         checked="1"
                      {% endif %}
                         onclick="endis_other('{{cyc}}', sma_cycle_other);"
                         /> {{ cycle_d[cyc] }}
              {% if cyc == "other" %}
              <br>
              <textarea name="sma_cycle_other"
                        class="wide_input" 
                        rows="2">{{cache.sma_cycle_other}}</textarea>
              {% endif %}
           {% endfor %}

         <!---------------------------------------------->
         <p>How do individuals join and leave the group/ministry?
         <br>
         <textarea name="sma_join_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_join_t}}</textarea>

         <!---------------------------------------------->
         <p>Preferred meeting days/dates (if known) and place:
         <br>
         <textarea name="sma_timeloc_t" 
                   class="wide_input" 
                   rows="5">{{cache.sma_timeloc_t}}</textarea>

         <!---------------------------------------------->
         <p>How does the group grow new leaders and plan for leadership
           succession?
           {% for s in succ_l %}
              <br><input type="checkbox" 
                         name="sma_succession"
                         value="{{ s }}"
              {% if s in cache.sma_succession %}
                         checked="1"
              {% endif %}
              {% if 'specify' in s %}
                         onclick="toggle(sma_succ_other_val_t);"
              {% endif %}
                  /> {{ s }}
              {% if s.startswith("Other") %}
              <br>
              <textarea name="sma_succ_other_val_t" 
                        class="wide_input" 
                        rows="5">{{cache.sma_succ_other_val_t}}</textarea>
              {% endif %}
           {% endfor %}

         <!---------------------------------------------->
         <p>What does the group do or plan to do to minimize burn-out?
           {% for s in burnout_l %}
              <br><input type="checkbox" 
                         name="sma_burnout"
                         value="{{ s }}"
              {% if s in cache.sma_burnout %}
                         checked="1"
              {% endif %}
              {% if 'specify' in s %}
                         onclick="toggle(sma_burn_other_val_t);"
              {% endif %}
                  /> {{ s }}
              {% if s.startswith("Other") %}
              <br>
              <textarea name="sma_burn_other_val_t"
                        class="wide_input" 
                        rows="5">{{cache.sma_burn_other_val_t}}</textarea>
              {% endif %}
           {% endfor %}

         <!---------------------------------------------->
         <p>How does the group handle or plan to handle conflict?
           {% for s in conflict_l %}
              <br><input type="checkbox" 
                         name="sma_conflict"
                         value="{{ s }}"
              {% if s in cache.sma_conflict %}
                         checked="1"
              {% endif %}
              {% if 'specify' in s %}
                         onclick="toggle(sma_conf_other_val);"
              {% endif %}
                  /> {{ s }}
              {% if s.startswith("Other") %}
              <br>
              <textarea name="sma_conf_other_val" 
                        class="wide_input" 
                        rows="5">{{cache.sma_conf_other_val}}</textarea>
              {% endif %}
           {% endfor %}

         <!---------------------------------------------->
         <p>Upon completion, or at milestones, how will you 
           celebrate/recognize/thank people, or provide closure?
         <br>
         <textarea name="sma_celebrate_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_celebrate_t}}</textarea>

         <!---------------------------------------------->
         <p>SECTION 4: GROUP FUNCTIONS--LEARN, SERVE, CARE

         <p>Strong religious groups, while perhaps focusing on one of these
           three functions, attend to all three. Group members learn
           together, serve the wider community (church or beyond), and care
           for each other in times of need. ORUUC groups are asked to
           attend to all three functions. Staff can assist you in
           completing this section, if that would be helpful.
           Which of the three functions is primary for your
           Group/Ministry?
           {% for f in func_l %}
              <br><input type="radio" name="sma_function" 
                         value="{{f}}"
                         {% if cache.sma_function == f %}
                         checked="1"
                         {% endif %}
                         /> {{ f.capitalize() }}
           {% endfor %}

         <!---------------------------------------------->
         <p>How do you incorporate the other two functions in the life of
         your Group/Ministry?
         <br>
         <textarea name="sma_altfunc_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_altfunc_t}}</textarea>

         <!---------------------------------------------->
         <P>Section 5: Resources & Support
         <p>What ORUUC resources does your group/ministry need?
         <p>Staff Support:
         <br>(Please identify staff person, their role, and approximate
         number of hours.)
         <br>
         <textarea name="sma_resource_staff_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_resource_staff_t}}</textarea>

         <!---------------------------------------------->
         <p>Financial Resources
         <br>(Describe briefly any financial needs.)
         <br>
         <textarea name="sma_resource_money_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_resource_money_t}}</textarea>

         <!---------------------------------------------->
         <p>Facilities:
         <br>(Room needs)
         <br>
         <textarea name="sma_resource_room_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_resource_room_t}}</textarea>

         <!---------------------------------------------->
         <p>Facilities:
         <br>(Storage needs)
         <br>
         <textarea name="sma_resource_storage_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_resource_storage_t}}</textarea>

         <!---------------------------------------------->
         <p>Training
         <br>(Is there any special training or leadership development
         your group needs?)
         <br>
         <textarea name="sma_resource_train_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_resource_train_t}}</textarea>

         <!---------------------------------------------->
         <p>Communication needs such as church newsletter, What's
         Happening, Calendar, Facebook groups, etc.:
         <br>
         <textarea name="sma_resource_comm_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_resource_comm_t}}</textarea>

         <!---------------------------------------------->
         <p>Church Policies/Guidelines:
         <br>(Identify any policies or guidelines that may need to be
         created or clarified.)
         <br>
         <textarea name="sma_clarification_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_clarification_t}}</textarea>

         <!---------------------------------------------->
         <p>What concerns/problems do you have or anticipate?
         <br>
         <textarea name="sma_concerns_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_concerns_t}}</textarea>

         <!---------------------------------------------->
         <p>How could the "Shared Ministry Agreement" process be
         improved?
         <br>
         <textarea name="sma_improve_t"
                   class="wide_input" 
                   rows="5">{{cache.sma_improve_t}}</textarea>
         
         <!---------------------------------------------->
         <p>Reviewed for:
           {% if cache.sma_annual_review != None %}
             {% for year in cache.sma_annual_review.split() %}
               {% if year != this_year %}
               <br><input type="checkbox" disabled checked/> {{year}}
               {% endif %}
             {% endfor %}
           {% endif %}
           <br><input type="checkbox"
                      name="sma_annual_review"
           {% if cache.sma_annual_review != None and this_year in cache.sma_annual_review %}
                      checked="1"
           {% endif %}
                      /> {{this_year}}

         <!---------------------------------------------->
         {% include "post_table.html" %}
       </form>
      
    {% elif action == 'view' %}

      {% include "error.html" %}

      <center>
      <h1>ORUUC</h1>
      <h2>Shared Ministry Agreements</h2>
      <h2>{{group.sma_name}}</h2>

      <br>Last updated {{group.sma_updated.strftime(dt_format)}} 
          by {{group.sma_updater.nickname()}}
      <br><a href="/">back to group list</a>
      </center>
      
      <!---------------------------------------------->
      <hr>
      <h4>Section 1: Group Information</h4>

      <!---------------------------------------------->
      <p class="bold">Name of Group/Ministry:
        <blockquote>{{group.sma_name}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Purpose/Description of Group/Ministry:
        <blockquote>{{group.sma_purpose_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Co-leaders:
         <blockquote>{{group.sma_leaders.replace("\n", "<br>")}}</blockquote>

      <!-- -------------------------------------------->
      <p class="bold">Members:
        <blockquote>{{group.sma_members.replace("\n", "<br>")}}</blockquote>

      <!---------------------------------------------->
      <hr>
      <h4>Section 2: How this group connects with the rest of
      ORUUC</h4>

      <p class="bold">Staff Liason:
        <blockquote>{{staff_name}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Coordinating Council Liason (if known):
        <blockquote>{{group.sma_council.replace("\n", "<br>")}}</blockquote>
      
       <!---------------------------------------------->
      <div style="border:1px solid black;padding-left:10px">
      <font size="+1">
      <p>ORUUC's Vision: harmonious, respectful and loving
    relationships with
         all of creation.
      <p>ORUUC's Mission: We are a diverse, religious community
      joyfully
          nurturing one another in our lifelong spiritual journeys,
      and
          committing to tranform ourselves and the world around us
      through
          acts of compassion, love and social justice.
      </font>
      </div>

      <p class="bold">How this group/ministry supports ORUUC’s Vision
      and
      Mission:
        <blockquote>{{group.sma_support_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Primary Strategic Goal pursued by this group:
        <blockquote>
          {% for gnum in range(1,8) %}
            {% if 'goal_%d' % gnum in group.sma_goal %}
              {{goal_list[gnum-1]}}
              <br>
            {% endif %}
          {% endfor %}
        </blockquote>

      <!---------------------------------------------->
      <p class="bold">How this ministry pursues that goal/objective:
        <blockquote>{{group.sma_goalhow_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Other Strategic goals or objectives pursued by
        this group:
        <blockquote>
          {% for gnum in range(1,8) %}
            {% if 'goal_%d' % gnum in group.sma_altgoals %}
              {{goal_list[gnum-1]}}
              <br>
            {% endif %}
          {% endfor %}
        </blockquote>

      <!---------------------------------------------->
      <p class="bold">With what other ORUUC groups (if any) does your
      group
      interact?
        <blockquote>{{group.sma_other_groups_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">How this group shares what it is doing with the
      wider
      congregation:
        <blockquote>
          {% for s in group.sma_comm %}
            {{s.encode()}}
            {% if s.encode().startswith('Other') %}
              {{group.sma_comm_other}}
            {% endif %}
            <br>
          {% endfor %}
        </blockquote>

      <!---------------------------------------------->
      <p class="bold">Safety/liability concerns if any:
      <blockquote>{{group.sma_safety_t}}</blockquote>
        
      <!---------------------------------------------->
      <hr>
      <p class="bold">Section 3: GROUP PROCESS

      <p class="bold">Time Period
      <blockquote>
        {% if group.sma_cycle == "other" %}
           {{group.sma_cycle}}: {{group.sma_cycle_other}}
        {% else %}
           {{group.sma_cycle}}
        {% endif %}
      </blockquote>

      <!---------------------------------------------->
      <p class="bold">How individuals join and leave the
      group/ministry:
      <blockquote>{{group.sma_join_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Preferred meeting days/dates (if known) and
      place:
      <blockquote>{{group.sma_timeloc_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Leadership growth and succession strategies:
        <blockquote>
          {% for s in group.sma_succession %}
            {{ s.encode() }}
            {% if s.encode().startswith('Other') %}
              {{group.sma_succ_other_val_t.encode()}}
            {% endif %}
            <br>
          {% endfor %}
        </blockquote>

      <!---------------------------------------------->
      <p class="bold">Burn-out avoidance strategies:
        <blockquote>
          {% for s in group.sma_burnout %}
            {{ s.encode() }}
            {% if s.encode().startswith('Other') %}
              {{group.sma_burn_other_val_t.encode()}}
            {% endif %}
            <br>
          {% endfor %}
        </blockquote>

      <!---------------------------------------------->
      <p class="bold">How does the group handle or plan to handle
      conflict?
        <blockquote>
          {% for s in group.sma_conflict %}
            {{ s.encode() }}
            {% if s.encode().startswith('Other') %}
              {{group.sma_conf_other_val.encode()}}
            {% endif %}
            <br>
          {% endfor %}
        </blockquote>

      <!---------------------------------------------->
      <p class="bold">Upon completion, or at milestones, how will you 
        celebrate/recognize/thank people, or provide closure?
        <blockquote>{{group.sma_celebrate_t}}</blockquote>

      <!---------------------------------------------->
      <hr>
      <p class="bold">SECTION 4: GROUP FUNCTIONS--LEARN, SERVE, CARE

      <p>Strong religious groups, while perhaps focusing on one of
        these three functions, attend to all three. Group members learn
        together, serve the wider community (church or beyond), and care
        for each other in times of need. ORUUC groups are asked to
        attend to all three functions. Staff can assist you in
        completing this section, if that would be helpful.
        Which of the three functions is primary for your
        Group/Ministry?
        <blockquote>
          {% for f in func_l %}
            {% if group.sma_function == f %}
              {{ f.capitalize() }}
            {% endif %}
          {% endfor %}
        </blockquote>
      <!---------------------------------------------->
      <p class="bold">How do you incorporate the other two functions
      in the life of your Group/Ministry?
         <blockquote>{{group.sma_altfunc_t}}</blockquote>

      <!---------------------------------------------->
      <hr>
      <p class="bold">Section 5: Resources & Support
      <p class="bold">What ORUUC resources does your group/ministry
      need?
      <p class="bold">Staff Support:
       <blockquote>{{group.sma_resource_staff_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Financial Resources
       <blockquote>{{group.sma_resource_money_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Facilities (room needs):
      <blockquote>{{group.sma_resource_room_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Facilities (storage needs):
      <blockquote>{{group.sma_resource_storage_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Training Needs:
      <blockquote>{{group.sma_resource_train_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Communication needs:
      <blockquote>{{group.sma_resource_comm_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Church Policies/Guidelines:
      <blockquote>{{group.sma_clarification_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Anticipated concerns/problems:
      <blockquote>{{group.sma_concerns_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">How the "Shared Ministry Agreement" process
      could be improved:
      <blockquote>{{group.sma_improve_t}}</blockquote>

      <!---------------------------------------------->
      <p class="bold">Reviewed for years:
        <blockquote>{{group.sma_annual_review}}</blockquote>

    {% elif action == 'hide' %}


    {% elif action == 'delete' %}
      <h1>Is this the one to delete?</h1>

      {% include "error.html" %}

      <form action="/group/delete" method="post">
        <input type="hidden" name="action" value="delete" />
        <input type="hidden" name="group_id" value="{{group_id}}" />
        <table><tr>
            <td>Name
            <td>{{cache['sma_name']}}
          </tr><tr>
            <td>Purpose
            <td>{{cache['sma_purpose_t']}}
        </table>
        <input type="submit" name="submit" value="Cancel">
        <input type="submit" name="submit" value="Delete">
      </form>

    {% endif %}

  </body>
</html>
